package com.www.applyword.ui.my;

import android.text.TextUtils;
import android.widget.EditText;

import com.www.applyword.Constants.Constants;
import com.www.applyword.R;
import com.www.applyword.base.BaseActivity;
import com.www.applyword.bean.LoginBean;
import com.www.applyword.event.EventConstants;
import com.www.applyword.event.MessageEvent;
import com.www.applyword.http.CallBack;
import com.www.applyword.http.HttpClient;
import com.www.applyword.utils.SPUtil;
import com.www.applyword.utils.Utils;

import org.greenrobot.eventbus.EventBus;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;

/**
 * author : huang
 * date   : 2019/10/24 0024 18:05
 * version: 1.0
 */
public class PersonalEvaluationActivity extends BaseActivity {
    @BindView(R.id.et)
    EditText et;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.personal_evaluation_activity);
        setTitle("自我评价");
        setRringTitle("保存");
        tv_right.setOnClickListener(v -> {
            saveResumeEvaluate();
        });
    }


    @Override
    protected void loadData() {


    }


    private void saveResumeEvaluate() {
        if (TextUtils.isEmpty(et.getText().toString().trim())){
            Utils.showToastSafe("请先输入相关个人评价");
            return;
        }
        Map<String, Object> params = new HashMap<>();
        params.put("ResumeBasic_UserID", SPUtil.getString(Constants.USERID));
        params.put("ResumeBasic_Evaluate", et.getText().toString().trim());
        HttpClient.post(PersonalEvaluationActivity.this, Constants.RESUMEEVALUATE, params, new CallBack<LoginBean>() {
            @Override
            public void onSuccess(LoginBean result) {
                Utils.showToastSafe("保存成功");
                MessageEvent messageEvent = new MessageEvent();
                messageEvent.setMessageKey(EventConstants.DEL_RESUMESCHOOL);
                EventBus.getDefault().post(messageEvent);
                finish();
            }
        });
    }
}
